<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>animate动画</title>
    <link rel="stylesheet" href="css/swiper-bundle.min.css">
    <link rel="stylesheet" href="css/animate.min.css">
    <style>
        html,body{
            margin: 0;
            padding: 0;
        }
        .swiper{
            width: 600px;
            height: 300px;
            margin: 50px auto;
            border: 1px solid red;
        }
        .p1{
            font-size: 30px;
            text-align: center;
        }
        .ibc-scale{
            animation: ibc-scale;
        }
        @keyframes ibc-scale {
            100%{
                transform: scale(2);
            }
        }
    </style>
</head>
<body>
    <div class="swiper">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <p class="ani p1" swiper-animate-effect="ibc-scale" swiper-animate-duration="2s" swiper-animate-delay="0s">我是从左边出来的文字</p>
                <p class="ani p1" swiper-animate-effect="fadeInRight" swiper-animate-duration="2s" swiper-animate-delay="0s">我是从右边出来的文字</p>
            </div>
            <div class="swiper-slide">
                <p class="ani p1" swiper-animate-effect="bounceInDown" swiper-animate-duration="2s" swiper-animate-delay="0s">我是从上往下掉的文字</p>
                <p class="ani p1" swiper-animate-effect="bounceInUp" swiper-animate-duration="2s" swiper-animate-delay="0s">我是从下往上掉的文字</p>
            </div>
            <div class="swiper-slide">Slide 3</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        
        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
        
        <!-- 如果需要滚动条 -->
        <div class="swiper-scrollbar"></div>
    </div>
    <script src="js/swiper-bundle.min.js"></script>
    <script src="js/swiper.animate1.0.3.min.js"></script>
    <script> 
        //Swiper5
        var mySwiper = new Swiper ('.swiper', {
             // 如果需要分页器
            pagination: {
                el: '.swiper-pagination',
            },
            
            // 如果需要前进后退按钮
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
            on:{
                init: function(){
                    swiperAnimateCache(this); //隐藏动画元素 
                    swiperAnimate(this); //初始化完成开始动画
                }, 
                slideChangeTransitionEnd: function(){ 
                    swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
                    //this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次，去除ani类名
                } 
            }
        }) 
    </script>
</body>
</html>